import Vue from 'vue'
import Vuex from 'vuex'
import VuexPersistence from 'vuex-persist'

// 模块化管理vuex
import app from './modules/app'
import user from './modules/user'

Vue.use(Vuex)

// 持久化vuex的插件
const vuexLocal = new VuexPersistence({
  storage: window.sessionStorage
})

const store = new Vuex.Store({
  modules: {
    app,
    user
  },
  plugins: [vuexLocal.plugin]
})

export default store
